// 导入请求模块
import request from "@/utils/request.js"

// 分页查询
export const productPageService = (pageQuery) => {
    return request.get('/product/page', { params: pageQuery })
}

// 查询商品分页和分类、品牌信息列表
export const fullProductList = (pageQuery) => {
    return request.get('/product/fullList', { params: pageQuery })
}

// 查询回显
export const productByIdService = (id) => {
    return request.get('/product/' + id)
}

// 查询回显DTO
export const productDTOByIdService = (id) => {
    return request.get('/product/dto/' + id)
}

// 根据ID逻辑删除商品
export const logicDeleteByIdService = (id) => {
    return request.put('/product/delete/' + id)
}

// 保存商品信息
export const saveProductService = (editForm) => {
    return request.put('/product', editForm)
}
// 获取广告
export const getAdvertiseService = () => {
    return request.get('product/ad')
}
// 获取主页商品 部分或全部
export const getHomeProductService = (type,isHome) => {

    return request.get('product/home/'+type+'/'+isHome)
}

// 添加商品
export const addProductService = (addForm) => {
    return request.post('/product', addForm)
}
// 根据商品ID查询相关分类并返回同分类商品
export const getRelatedProductService = (id) => {
    return request.get('/product/related/' + id)
}
// 查询父级分类信息
export const getParentCategoryService = () => {
    return request.get('/product/parent')
}
// 根据父级分类ID查询子级分类的所有商品
export const getChildCategoryService = (id) => {
    return request.get('/product/child/' + id)
}
// 根据关键字搜索商品
export const searchProductService = (ProductSearch) => {
    return request.get('/product/search/',{ params: ProductSearch })
}

export const getCategoryListVO = () => {
    return request.get('/product/category_vo')
}
